// pages/goods/list/list.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		id: 259,
		pg: 1,
		pd: false,
		http:getApp().globalData.map,
		data:[]
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		console.log(options)
		wx.getStorage({
			key:'uid',
			success: (e) => {
				this.setData({
					id:options.id,
					uid:e.data.uid
				})
				this.pl()
			}
		})
	},
	pl() {
		let a=this.data.data
		wx.request({
			url: getApp().globalData.http + 'action=shopCommeentList&shopid=' + this.data.id + '&pg=' + this.data.pg+'&uid='+this.data.uid,
			success: (e) => {
				console.log(e)
				e.data.data.forEach(function(item,index){
					a.push(item)
				})
				if (e.data.data.length < 15) {
					this.setData({
						pd: true
					})
				}
				this.setData({
					data: a
				})
			}
		})
	},
	ovo() {
		if (this.data.pd == 'false') {
			let a = this.data.pg + 1
			this.setData({
				pg: a
			})
			this.pl()
		}
	},
})
